#include <iostream>
#include <algorithm>
using namespace std;
// #define int long long
#define endl '\n'
#define P pair<int, int>
#define x first
#define y second
constexpr int maxl = 1e6 + 7;

int n, ans;
int a[maxl];
int dp[maxl];

void solve()
{
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];

  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; i++) {
      dp[a[i]]++;
      ans = max(ans, dp[a[i]]);
      for (int j = 2; j * a[i] <= maxl; j++) {
      dp[j * a[i]] = max(dp[j * a[i]], dp[a[i]]);
    }
  }

  cout << ans << endl;
}


signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int t = 1;
  // cin >> t;
  while (t--)
    solve();
  return 0;
}